<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core'%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /><!-- 控制浏览器文件模式为IE8 -->
<title>按鈕權限分配頁面</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<link href="js/artDialog/skins/default.css" rel="stylesheet" type="text/css" />
<link href="css/sele.css" rel="stylesheet" type="text/css" />
<script src="js/jquery-1.7.2.min.js"></script>
<script src="js/artDialog/artDialog.js?skin=blue"></script>
<script src="js/artDialog/plugins/iframeTools.js"></script>
<script type="text/javascript" src="js/operamasks-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/elegant/om-all.css" />
<style>
	td,span,caption,input{ font-size:12pt;}
	body{font-family:'微软雅黑'; margin:0 auto; min-width:600px; }
</style>
<script type="text/javascript">
	function returnResult(){
		var retrunStr="";
		var nodeCode=$("#nodeCode").val();
		var roleId=$("#roleId").val();
		var chks = $(":checkbox:checked");
	   	$.each(chks,function(k,v){
	   		retrunStr += v.value+';';
	   	});			   		
		var params={
			"nodeCode" : nodeCode,
			"roleId" : roleId,
			"retrunStr" : retrunStr
		};
		var actionUrl = '${pageContext.request.contextPath}/adminRole.do?action=addFunctionRoleOption';
		$.ajax({
			type : "POST",
			url : actionUrl,
			data : params,
			type : 'post',
			dataType : "text",
			cache : false,
			success : function(data, textStatus) {
				alert("系統提示,添加角色功能按鈕權限成功！"+data);
				window.returnValue = nodeCode+";"+roleId+";"+retrunStr;
				window.close();
			}
		});
	}
</script>
</head>
<body >
	<input type="hidden" value="${nodeCode }" id="nodeCode"/>
	<input type="hidden" value="${nodeName}" id="nodeName"/>
	<input type="hidden" value="${roleId}" id="roleId"/>
	<table class="tablelist">
		<caption style="margin: 10px">按鈕清單</caption>
		<thead>
			<tr>
				<th></th>
				<th>序號</th>
				<th>操作編碼</th>
			    <th>描述</th>                 
			</tr>
		</thead>
		<tbody>
			<c:set var="i" value="0" /> 
			<c:forEach var="fOList" items="${functionOptionList}" varStatus="statusD">
				<c:set var="i" value="${i+1}" />
				<tr>
					<td align="center">
						<input type="checkbox" id="${fOList.optionId }" <c:if test="${fOList.isSelect == '1'}"> checked="checked" </c:if> value="${fOList.optionId }"/>
					</td>
					<td>${i }</td>
					<td>${fOList.optionId }</td>
					<td>${fOList.optionDsc }</td>
				</tr>
			</c:forEach>
			</tbody>
	</table>
	<ul class="forminfo" style="margin-top:30px;margin-left: 100px">
		<li>
			<label>&nbsp;</label>
			<input type="button" id="save" onclick="returnResult();" class="btn"  value="确定"/> 
		</li>
	</ul>  
</body>
</html>